Gas analyzers, either configured as photoacoustic gas detectors or as non-dispersive spectrometers, provide a simple way of analyzing the composition of gases. Since the analysis of the composition of ambient air, e.g., due to pollution, is becoming increasingly important, it is desirable to provide a gas analyzer with a compact structure that is flexible at use.